//
//  SingerFormView.m
//  FormTableViewDemo
//
//  Created by zkingsoft on 16/1/5.
//  Copyright (c) 2016年 zkingsoft. All rights reserved.
//

#import "SingerFormView.h"

@interface SingerFormView ()

// formView中的子view 用于显示内容
@property (nonatomic, strong) UILabel *formContentLabel;

@end

@implementation SingerFormView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        // 初始化
        _formContentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        _formContentLabel.textAlignment = NSTextAlignmentCenter;
        self.backgroundColor = [UIColor whiteColor];
        
        [self addSubview:_formContentLabel];
        
        UITapGestureRecognizer *formTapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SingerFormViewIsClicked:)];
        [self addGestureRecognizer:formTapGes];
    }
    return self;
}


// tap方法 并调用协议方法
- (void)SingerFormViewIsClicked:(UITapGestureRecognizer *)sender{
    if ([_delegate respondsToSelector:@selector(FormViewIsClicked:)]) {
        [_delegate FormViewIsClicked:self];
    }
}



// text的set方法 将传进来的值 赋值给text 并显示到label中
- (void)setFormContentText:(NSString *)formContentText{
    _formContentText = formContentText;
    
    self.formContentLabel.text = _formContentText;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
